import dayjs from '@/plugins/dayjs'
import { FetchMeetingDoc, ItemStatus } from '@/api/meetingSpace'

export interface ITableData {
	creator: string
	fileId: string
	fileName: string
	fileSize: string
	fileUrl: string
	createTime: string
	status: ItemStatus
}
export function transMeetingDocItem(item: FetchMeetingDoc): ITableData {
	const fileSize = parseFloat(item.file_size) < 0.01 ? `0.01M` : `${parseFloat(item.file_size)?.toFixed(2) ?? 0}M`
	const createTime = dayjs(item.create_time).format('YYYY-MM-DD HH:mm')
	return {
		creator: item.creator_name,
		fileName: item.file_name,
		fileId: item.file_id,
		fileSize,
		fileUrl: item.file_url,
		createTime,
		status: item.status,
	}
}
